component extends="GenericWrapped" output="False" {

	variables.set = False;

	public KeyspaceDef function init(String name, 
			String strategyClass="org.apache.cassandra.locator.SimpleStrategy") {
		variables._wrapped = CreateObject("java", "org.apache.cassandra.thrift.KsDef").init();
		variables.set = True;
		// if a name was passed in, set it
		if (StructKeyExists(arguments, "name")) {
			this.setName(arguments.name);
		}
		// if a strategy class was passed in, set it
		if (StructKeyExists(arguments, "strategyClass")) {
			this.setStrategyClass(strategyClass);
		}
		return this;
	}

	/**
	* Sets the name of the keyspace. If the keyspace hasn't been created yet it be 
	* created first.
	*/
	public void function setName(required String keyspace) {
		if (!variables.set) {
			this.init();
		}
		variables._wrapped.setName(keyspace);
	}

	/**
	* Sets the strategy class for this keyspace. If the keyspace has't been initialised
	* it will be created first.
	*/
	public void function setStrategyClass(required String strategy="org.apache.cassandra.locator.SimpleStrategy") {
		if (!variables.set) {
			this.init();
		}
		variables._wrapped.setStrategy_class(strategy);
	}

	public void function setReplicationFactor(required Numeric replicationFactor) {
		if (!variables.set) {
			this.init();
		}
		variables._wrapped.setReplication_factor(replicationFactor);
	}

	/**
	* Sets the strategy option for the keyspace. If the keyspace hasn't been createed it
	* will be created first. The call takes a CF StrategyOptions component and therefore
	* needs to access the underlying 
	*/
	public void function setStrategyOptions(required StrategyOptions strategyOptions) {
		if (!variables.set) {
			this.init();
		}
		variables._wrapped.setStrategy_options(strategyOptions._fetch());
	}

	public void function setCFDefs(required CFDefList cfdeflist) {
		variables._wrapped.setCf_defs(cfdeflist._fetch());
	}

}